import Vue from 'vue'
import VueRouter from 'vue-router'
import IndexRouter from './index/'
import LoginRouter from './login/'
import ViewsRouter from './views/'
const _import = require('./_import')
Vue.use(VueRouter)
VueRouter.prototype.goBack = function(page) {
    page = page || -1;　
    this.isBack = true;
    this.go(page);
}
export default new VueRouter({
    scrollBehavior(to, from, savedPosition) {
        if (savedPosition) {
            return savedPosition
        } else {
            if (from.meta.keepAlive) {
                from.meta.savedPosition = document.body.scrollTop
            }
            return {
                x: 0,
                y: to.meta.savedPosition || 0
            }
        }
    },
});
export const asyncRouterMap = [

].concat(IndexRouter, LoginRouter, ViewsRouter)